from __future__ import annotations

from dataclasses import dataclass


@dataclass
class CostModel:
    commission_rate: float = 0.0003
    commission_min: float = 5.0
    stamp_tax_rate: float = 0.0005
    transfer_fee_rate: float = 0.00001
    slip_rate: float = 0.02

    def estimate_trade_cost(self, price: float, qty: int, side: str) -> float:
        notional = price * qty
        commission = max(self.commission_rate * notional, self.commission_min)
        stamp_tax = self.stamp_tax_rate * notional if side.upper() == "SELL" else 0.0
        transfer_fee = self.transfer_fee_rate * notional
        slip = self.slip_rate * notional
        return commission + stamp_tax + transfer_fee + slip




